package com.iticit.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {
	
	static SimpleDateFormat DATE_FORMAT = null;
	static final String PATTERN = "yyyyMMddHHmmss";
	private static SimpleDateFormat getDateFormat(String pattern) {
		if(pattern != null && !"".equals(pattern)) {
			DATE_FORMAT = new SimpleDateFormat(pattern);
		} else {
			DATE_FORMAT = new SimpleDateFormat(PATTERN);
		}
		return DATE_FORMAT;
	}

	public static String format(Date date, String pattern) {
		return getDateFormat(pattern).format(date);
	}
}
